Boduka Codes taken from Nov, 2000


ABDUCT

more abduct.c


// Abduction, for the new ninja guild
// 3/11/00 Wisp    - Fixed the post delay.
// 22 Mar 00 Hawk - changed to use add_effect

#include 
#include 
inherit CMD_BASE;

#define CS         "covert.stealth"
#define UA         "fighting.combat.melee.unarmed"
#define ROOM       "/d/chaos/budoka/special/rift_room"
#define MAX        800
#define MIN        100
#define COST      -300
#define DELAY      1
#define POST_DELAY 8 // Seconds before we can try again
#define LAST_PROP  "abduct_time"
#define BLOCK_PROP "no_abduct"

int query_valid_use( object ob )
{
    if( !ob->query_property( "com_list" ) || ob->query_property( "com_list"
)["sixth"]
      != "abduct" ) return 0;
    return 1;
}
string help()
{
    return
    "Skill: Abduct\n"
    "Usage: abduct [me|target]\n"
    "Guild Point Cost: " + COST + "\n"
    "Description:\n"
    "  One of the most difficult arts of the Budoka to master is that "
    "of rifting.  You may abduct a target, taking them through a rift "
    "in space for a short period of time.  If you conceal yourself first "
    "you will have a greater chance of success.  If you feel the need, "
    "you may rift yourself away.\n\n"
    "Abduct uses your skill in covert.stealth and f.c.m.unarmed.\n";
}
string ab_checks( object me, object him )
{
    if( me->query_gp() < (-1 * COST ) )  
        return "You are far too exhausted!\n";

    if( !environment( me ) || environment( me )->query_rift() )
        return "You cannot abduct from the void!\n";
    if( !living( him ) )
        return "You see little point in abducting something that does not
live.\n";
    if( him->query_dead() )
        return "You cannot abduct a ghost.\n";

    if( him->query_property_exists( BLOCK_PROP ) )
        return "You are unsure of how to abduct "+him->pretty_short()+".\n";

    if( !him || !environment( me ) || !present( him, environment( me ) ) )
        return "Your target is no longer present.\n";

    if( me->query_entangled() || me->query_frozen() )
        return "You are unable to move well enough to complete this difficult
maneuver!\n";

    if( him->query_entangled() || him->query_frozen() )
        return him->pretty_short()+ " is somehow hindered. You cannot abduct "
+
        him->query_objective() + "!\n";

}

protected int cmd( class command cmd )
{
    object *targs, him;
    string *list, fail;
    if( !cmd->user->query_property( "com_list" ) || 
        cmd->user->query_property( "com_list" )["sixth"]
        != "abduct" ) return 0;
    if( cmd->arg == "help" )
    {
        tell_object( cmd->user, help() );
        retu        return 1;
    }
    seteuid( getuid() );

    if( cmd->user->query_casting_spell( "offensive" ) )
        return notify_fail( "You are too busy to use this ability right now.\n"
);
    if( time() < cmd->user->query_property( LAST_PROP ) + POST_DELAY ) 
        return notify_fail( "You do not have the energy to attempt this "
          "complicated manuever again so soon.\n" );

    if( !cmd->arg )
        him = cmd->user;
    else
    {
        list = ({ cmd->arg });

        if( strsrch( cmd->arg, "," ) != -1 )
            list = explode( cmd->arg, "," );

        targs = find_match( cmd->user->expand_nickname( cmd->arg ),
environment( cmd->user ) );

        if( !sizeof( targs ) )
            return notify_fail( "You do not see your target.\n" );
        else
            him = targs[0];

    }
    if( fail = ab_checks( cmd->user, him ) )
        return notify_fail( fail );

    if( him == cmd->user )
        tell_object( cmd->user, "You prepare to rift yourself away!\n" );
    else 
        tell_object( cmd->user, "You prepare to abduct
"+him->pretty_short()+"!\n" );

    cmd->user->add_effect( "/cmds/guild/budoka/abduct", ({ him, cmd->user }),
      "offensive", 1 );
    return 1;
}


int query_heart_beat_frequency() { return 1; }
int effect_heart_beat( object ob, mixed args )
{
    object room, putz, me, start_room;
    int meskill, chance, stealth, time, images = 0;
    string fail;

    me = args[1];
    putz = args[0];

    fail = ab_checks( me, putz );

    start_room = ENV( me );

    if( putz != me && !fail )
    {
        meskill = me->query_skill_bonus( CS )/4 + me->query_skill_bonus( UA )/4
;

        if( meskill > MAX )
            meskill = MAX;

        if( meskill < MIN )
            meskill = MIN;
        meskill += me->query_level() - putz->query_level();

        if( intp( images = putz->query_def_args( "layers" )) )
            meskill -= images * 20;

        if( putz->query_invisible() )
            meskill -= 100;
        else if( putz->query_hidden() )
            meskill -= 75;

        if( me->query_hidden() )
        {
            stealth = 1;
            meskill += 75;
        }
        else if( me->query_invisible() )
        {
            stealth = 1;
            meskill += 100;
        }

        if( sizeof( putz->query_attacker_list()) )
            meskill += 100;


/cmds/guild/budoka/abduct.c From 145 to 169 of 268 (63%) - q to quit. 

        if( sizeof( me->query_attacker_list()) )
        {
            stealth = 0;
            meskill /= 3;
        }

        if( meskill > ( chance = random( 1000 ) ) )
        {      
            if( stealth )
            {
                tell_object( putz, "With a flash, a dark figure leaps from the
shadows "
                  "and grabs you from behind!\n" );
                tell_object( me, "You leap forth and grasp "
+putz->pretty_short()+ 
                  " from the rear and drag " +putz->query_objective()+ 
                  " through a rift in space.\n" );
            }

            else
            {
                tell_object( putz, me->pretty_short()+" leaps at you with a
flash and "
                  "abducts you!\n" );
                tell_object( me, "You leap forth and grasp " +
putz->pretty_short()+
                  " and drag " +putz->query_objective()+
                  " through a rift in space!\n" );
                tell_room( start_room, me->pretty_short()+" leaps toward "
                  + putz->pretty_short()+ " and drags "
                  + putz->query_objective()+ " through a rift in space!\n",
                  ({ me, p                  ({ me, putz }) );
            }
            fail = 0;
        }
        else if( chance > meskill + 500 )  // Miserable fail
        {
            putz->remove_invis( "noise" );
            if( stealth )
            {
                me->remove_invis( "combat" );
                tell_room( start_room,  me->pretty_short()+
                  " leaps from the shadows and slams into "
                  +putz->pretty_short()+ " with a crash.\n", ({ me, putz }) );
                tell_object( putz, me->pretty_short()+ " leaps from the
shadows"
                  " and slams into you aggressively!\n" );
            }
            else
            {
                tell_room( start_room,  me->pretty_short()+
                  " leaps forward and slams into "
                  +putz->pretty_short()+ " with a crash!\n", ({ me, putz }) );

                tell_object( putz, me->pretty_short()+ " leaps forward and
slams "
                  "into you aggressively!\n" );
            }
            fail = "You leap at " +putz->pretty_short()+ " but fail "
            "miserably!\n";
        }
        else if( chance > meskill + 250 ) // Fail
        {
            if( stealth )
            {
                tell_object( putz, "You think you noticed something move in
towards you"
                  " from the shadows but are not quite sure.\n" );
            }
            fail = "You leap at " +putz->pretty_short()+ " but realize "
            "that you will fail and hold yourself back.\n";        
        }
        else  // Didn't go through with it ;)
        {
            fail = "You leap at " +putz->pretty_short()+ " but quickly realize
"
            "that you will fail and hold yourself back before you are
noticed!\n";         }
    } 
    else if( !fail )
    {
        if( !me->query_hidden() && !me->query_invisible() )
            tell_room( start_room, me->pretty_short()+ " rips an invisible rift
"
              "in space and leaps through it!\n", ({ me }) );

        tell_object( me, "You rip an invisible rift in space and leap through
it!\n" );
        fail = 0;
    }

    if( !fail )
    {
        me->add_property( LAST_PROP, time() );
        room = clone_object( ROOM );
        room->return_room( start_room );
        room->set_master( me );
        me->move( room );

        if( putz != me ) 
        {    
            putz->remove_invis( "noise" );
            putz->move( room );
            time = random(4) + me->query_level()/100 + 1;       
        } else time = me ->query_level() / 10 + random( 10 );

        room->set_time( time );
    } else tell_object( me, fail );

    me->adjust_gp( COST );
    return REMOVE_THIS_EFFECT;
}














1